package ru.rchervot.sanasar.client.event;

import com.google.gwt.event.shared.GwtEvent;

public class EventUIResultsScrollChange extends GwtEvent<HandlerUIResultsScrollChange> {
	private static Type<HandlerUIResultsScrollChange> TYPE = new Type<HandlerUIResultsScrollChange>();
	
	private int scrollOffset;
	
	public EventUIResultsScrollChange() {
	} //TODO why not remove ?
	
	public EventUIResultsScrollChange(int scrollOffset) {
		this.scrollOffset = scrollOffset;
	}
	
	@Override
	protected void dispatch(HandlerUIResultsScrollChange handler) {
		handler.onScrollChange(this);
	}

	/**
	 * Gets the type associated with this event.
	 * 
	 * @return returns the handler type
	 */
	public static Type<HandlerUIResultsScrollChange> getType() {
		if (TYPE == null) {
			TYPE = new Type<HandlerUIResultsScrollChange>();
		}
		return TYPE;
	}

	public Type<HandlerUIResultsScrollChange> getAssociatedType() {
		return TYPE;
	}

	public int getScrollOffset() {
		return scrollOffset;
	}
	
	public static EventUIResultsScrollChange build(int scrollOffset) {
		return new EventUIResultsScrollChange(scrollOffset);
	}
}
